﻿//
// ImageGroup
//
// this holds the image blocks
//
package com.artworld {
	import flash.display.Sprite;
	
	public class ImageGroup extends Sprite {
		// holds the image blocks
		private var blocks:Array = new Array();
		private var _w:int = 0;		// the width
		private var _h:int = 0;		// the height
		// setup
		public function ImageGroup(w:int,h:int){
			_w = w;
			_h = h;
			for(var i:int = 0; i < h; i++){
				for(var j:int = 0; j < w; j++){
					var img:ImageBlock = new ImageBlock();
					img.x = j * 100;
					img.y = i * 100;
					addChild(img);
					blocks.push(img);
					img.loadImage();
				}
			}
		}
		// draw a sprite to the image blocks
		public function draw(sp:Sprite):void{
			for(var i:int = 0; i < blocks.length; i++){
				blocks[i].draw(sp);
				blocks[i].saveImage();
			}
		}
	}
}